package com.sfang.common.util.encrypt;

import java.io.UnsupportedEncodingException;

public class Base64Utils {
    public static String decode(String value) {
        try {
            return new String(org.apache.commons.codec.binary.Base64.decodeBase64(value.getBytes("UTF-8")));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }

    public static String encode(String value) {
        try {
            return new String(org.apache.commons.codec.binary.Base64.encodeBase64(value.getBytes("UTF-8")));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }
}
